package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.algorithm.MorphologicalOperationExecutor;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * 形态学操作算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建MorphologicalOperationExecutor实例
 */
public class MorphologicalOperationExecutorFactory implements AlgorithmExecutorFactory {
    private static final MorphologicalOperationExecutorFactory instance = new MorphologicalOperationExecutorFactory();

    private MorphologicalOperationExecutorFactory() {}
    
    /**
     * 获取工厂实例
     * @return MorphologicalOperationExecutorFactory实例
     */
    public static MorphologicalOperationExecutorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        MorphologicalOperationExecutor morphologicalOperationExecutor = new MorphologicalOperationExecutor();
        BeanUtils.copyProperties(param, morphologicalOperationExecutor);
        return morphologicalOperationExecutor;
    }
}